﻿/*
 * Created by SharpDevelop.
 * User: Administrator
 * Date: 2016/4/26
 * Time: 17:37
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Linq;
using SharpErp.Data.Common.Entity;

namespace SharpErp.Data.Common
{
	public class Program
	{
		public static void Main(string[] args)
		{
			Console.WriteLine("Hello World!");
			
			// TODO: Implement Functionality Here
		    using (var context = new Context.SharpErpDbContext())
		    {
		    	context.Delete(context.ItemClasses, p=>p.Id < 15);
		    	context.Clear(context.ItemClasses, p=>p.Id == 16);
		    	//Console.WriteLine("size:" + context.AllArray(context.ItemClasses).Length);
		        var item = new ItemClass
		        {
		            Name = "abc",
		            Id = 0
		        };
		        item.CreateTime = item.LastModifyTime = DateTime.Now;
				context.ItemClasses.Add(item);
				context.SaveChanges ();
				context.Delete(context.ItemClasses, p=>p.Id % 2 == 0);
				//Console.WriteLine("size:" + context.AllArray(context.ItemClasses).Length);
		    }
		    
		    Console.WriteLine("press any key to continue...");
		    Console.ReadKey();
		}
	}
}